<!--{template header}-->
<!--{template cp_header}-->

<div class="l_status c_form">
	<a href="cp.php?ac=credit"$cat_actives[base]>我的积分</a><span class="pipe">|</span>
	<a href="cp.php?ac=credit&op=rule"$cat_actives[rule]>积分规则</a><span class="pipe">|</span>
	<a href="cp.php?ac=credit&op=usergroup"$cat_actives[usergroup]>用户组规则</a><span class="pipe">|</span>
	<a href="cp.php?ac=credit&op=exchange"$cat_actives[exchange]>积分兑换</a>
</div>

<!--{eval
	$_TPL['cycletype'] = array(
		'0' => '一次性',
		'1' => '每天',
		'2' => '整点',
		'3' => '间隔分钟',
		'4' => '不限周期'
	);
}-->

<div class="c_form">
<!--{if empty($_GET['op'])}-->	

	<table cellspacing="0" cellpadding="0" class="formtable">
		<tr>
			<th width="150">经验值:</th>
			<td><span style="color:green;font-size:14px;">$space[experience]</span> <!--{eval echo getstar($space[experience]);}--></td>
		</tr>
		<tr><th width="150">&nbsp;</th><td class="gray">
			经验每满 <strong>$_SCONFIG[starcredit]</strong> 个，就会增加一个图标 <img src="image/star_level1.gif" align="absmiddle"><br>
			每满 <strong>$_SCONFIG[starlevelnum]</strong> 个当前图标就升级为 <strong>1</strong> 个高一等级图标<br>
			图标等级由低到高为：<!--{eval for($i=1;$i<11;$i++){}--><img src="image/star_level{$i}.gif"><!--{eval }}--></td></tr>
		<tr>
			<th width="150">用户组:</th>
			<td>
				<span<!--{eval g_color($space[groupid]);}-->>$space[grouptitle]</span>
				<!--{eval g_icon($space[groupid]);}-->
			</td>
		</tr>
		<tr>
			<th width="150">积分数:</th>
			<td>
			<img src="image/credit.gif">
			<span style="color:red;font-size:14px;">$space[credit]</span>
			<span class="gray">(<a href="space.php?do=top&view=credit">查看排名</a>)</span>
			</td>
		</tr>
		<tr><th>访问量:</th>
			<td>$space[viewnum] 
			<span class="gray">(<a href="space.php?do=top&view=viewnum">查看排名</a>)</span>
			</td></tr>
		<tr><th>创建时间:</th><td><!--{date('Y-m-d',$space[dateline],1)}--></td></tr>
		<tr><th>上次登录:</th><td><!--{date('Y-m-d',$space[lastlogin],1)}--></td></tr>
		<tr><th>最后更新:</th><td><!--{date('Y-m-d',$space[updatetime],1)}--></td></tr>

		<tr>
			<th>空间容量:</th>
			<td> 最大空间 $maxattachsize, 已用 $space[attachsize] ({$percent}%)</td>
		</tr>
		<!--{if $space[haveattachsize]}--><tr><th>剩余空间:</th><td>$space[haveattachsize]</td></tr><!--{/if}-->
	</table>
	<br>

	<table cellspacing="0" cellpadding="0" class="listtable">
		<caption>
			<h2>获得积分历史</h2>
			<p>显示你获得积分的动作列表，奖励积分值与经验值只记录最后一次获得的奖励</p>
		</caption>
		<thead>
		<tr class="title">
			<td>动作名称</td>
			<td align="center">总次数</td>
			<td align="center">周期次数</td>
			<td align="center">单次积分</td>
			<td align="center">单次经验值</td>
			<td align="center">最后奖励时间</td>
		</tr>
		</thead>
		<!--{if $list}-->
		<!--{loop $list $key $value}-->
		<tr<!--{if $key%2==0}--> class="line"<!--{/if}-->>
			<td><a href="cp.php?ac=credit&op=rule&rid=$value[rid]">$value[rulename]</a></td>
			<td align="center">$value[total]</td>
			<td align="center">$value[cyclenum]</td>
			<td align="center">$value[credit]</td>
			<td align="center">$value[experience]</td>
			<td align="center"><!--{date('m-d H:i',$value[dateline])}--></td>
		</tr>
		<!--{/loop}-->
		<!--{else}-->
		<tr>
			<td colspan="6">暂时没有获务任何积分</td>
		</tr>
		<!--{/if}-->
		<!--{if $multi}-->
		<tr>
			<td colspan="6"><div class="page">$multi</div></td>
		</tr>
		<!--{/if}-->
	</table>

<!--{elseif $_GET['op'] == 'exchange'}-->

	<form method="post" action="cp.php?ac=credit&op=exchange">
	<table cellspacing="0" cellpadding="0" class="formtable">
	<caption>
		<h2>积分兑换</h2>
		<p>您可以将自己的积分兑换到本站其他的应用（比如论坛）里面。</p>
	</caption>
	<tr><th width="150">目前您的积分数:</th><td> $space[credit]</td></tr>
	<tr>
		<th><label for="password">密码</label>:</th>
		<td><input type="password" name="password" class="t_input" /></td>
	</tr>
	<tr>
		<th>支出积分:</th>
		<td><input type="text" id="amount" name="amount" value="0" class="t_input" onkeyup="calcredit();" /></td>
	</tr>
	<tr>
		<th>兑换成:</th>
		<td>
			<input type="text" id="desamount" value="0" class="t_input" disabled />&nbsp;&nbsp;
			<select name="tocredits" id="tocredits" onChange="calcredit();">
			<!--{loop $_CACHE['creditsettings'] $id $ecredits}-->
				<!--{if $ecredits[ratio]}-->
					<option value="$id" unit="$ecredits[unit]" title="$ecredits[title]" ratio="$ecredits[ratio]">$ecredits[title]</option>
				<!--{/if}-->
			<!--{/loop}-->
			</select>
		</td>
	</tr>
	<tr>
		<th>兑换比率:</th>
		<td><span class="bold">1</span>&nbsp;<span id="orgcreditunit">积分</span><span id="orgcredittitle"></span>&nbsp;兑换&nbsp;<span class="bold" id="descreditamount"></span>&nbsp;<span id="descreditunit"></span><span id="descredittitle"></span></td>
	</tr>
	<tr><th>&nbsp;</th><td><input type="submit" name="exchangesubmit" value="兑换积分" class="submit"></td></tr>
	</table>
	<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
	</form>
	<script type="text/javascript">
		function calcredit() {
			tocredit = $('tocredits')[$('tocredits').selectedIndex];
			$('descreditunit').innerHTML = tocredit.getAttribute('unit');
			$('descredittitle').innerHTML = tocredit.getAttribute('title');
			$('descreditamount').innerHTML = Math.round(1/tocredit.getAttribute('ratio') * 100) / 100;
			$('amount').value = $('amount').value.toInt();
			if($('amount').value != 0) {
				$('desamount').value = Math.floor(1/tocredit.getAttribute('ratio') * $('amount').value);
			} else {
				$('desamount').value = $('amount').value;
			}
		}
		String.prototype.toInt = function() {
			var s = parseInt(this);
			return isNaN(s) ? 0 : s;
		}
		calcredit();
	</script>

<!--{elseif $_GET['op'] == 'rule'}-->

	<!--{if $list}-->
	<table cellspacing="0" cellpadding="0" class="listtable">
		<caption>
			<h2>积分奖励规则</h2>
			<p>进行以下事件动作，会得到积分奖励。不过，在一个周期内，您最多得到的奖励次数有限制。</p>
		</caption>
		<tr class="title">
			<td>动作名称</td>
			<td align="center">周期范围</td>
			<td align="center">周期内最多奖励次数</td>
			<td align="center" width="100">单次奖励分值</td>
		</tr>
		<!--{loop $list $key $value}-->
		<tr<!--{if $key%2==0}--> class="line"<!--{/if}-->>
			<td>$value[rulename]</td>
			<td align="center">$_TPL[cycletype][$value[cycletype]]</td>
			<td align="center"><!--{if $value[rewardnum]}-->$value[rewardnum]<!--{else}-->不限次数<!--{/if}--></td>
			<td align="center">$value[credit]</td>
		</tr>
		<!--{/loop}-->
	</table>
	<!--{/if}-->
	
	<!--{if $list2}-->
	<br>
	<table cellspacing="0" cellpadding="0" class="listtable">
		<caption>
			<h2>积分扣减规则</h2>
			<p>以下事件动作发生时，会扣减积分。其中，自己发布的信息自己删除，不扣减积分，被管理员删除才会扣减积分。</p>
		</caption>
		<tr class="title">
			<th>动作名称</th>
			<th align="center">单次扣减分值</th>
		</tr>
		<!--{loop $list2 $key $value}-->
		<tr<!--{if $key%2==0}--> class="line"<!--{/if}-->>
			<td>$value[rulename]</td>
			<td align="center" width="100">$value[credit]</td>
		</tr>
		<!--{/loop}-->
	</table>
	<!--{/if}-->
	
<!--{elseif $_GET['op'] == 'usergroup'}-->

	<table cellspacing="0" cellpadding="0" class="listtable">
	<caption>
		<h2>普通用户组</h2>
		<p>随着您的经验值的提高，您的用户组所拥有的权限也会越多。</p>
	</caption>
	<tr class="title">
		<th width="150">用户组名</th>
		<td>经验值范围</td>
	</tr>
	<!--{loop $groups $value}-->
	<tr>
		<th><span<!--{eval g_color($value[gid]);}-->>{$value[grouptitle]}</span><!--{eval g_icon($value[gid]);}--></th>
		<td>$value[explower] ~ $value[exphigher]</td>
	</tr>
	<!--{/loop}-->
	</table>
	
	<table cellspacing="0" cellpadding="0" class="listtable">
	<caption>
		<h2>特殊用户组</h2>
		<p>不受经验值限制。</p>
	</caption>
	<tr class="title">
		<th width="150">用户组名</th>
		<td>经验值范围</td>
	</tr>
	<!--{loop $s_groups $value}-->
	<tr>
		<th><span<!--{eval g_color($value[gid]);}-->>{$value[grouptitle]}</span><!--{eval g_icon($value[gid]);}--></th>
		<td>-</td>
	</tr>
	<!--{/loop}-->
	</table>

<!--{/if}-->

</div>

<!--{template footer}-->
